package com.bawei.system.remote.api;

import com.alibaba.fastjson2.JSONObject;
import com.bawei.common.core.constant.SecurityConstants;
import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.es.domain.IndexEntry;
import com.bawei.es.domain.IndexInfoResp;
import com.bawei.system.remote.factory.RemoteEsDocsFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author : zhangyu
 * @date 2023/11/16 21:29
 *
 *
 * 索引操作公共服务接口
 */

@FeignClient(contextId = "remoteEsIndexService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteEsDocsFallbackFactory.class)
public interface RemoteEsIndexService {


    @ApiOperation("创建索引")
    @PostMapping("create")
    public R createIndex(@RequestBody IndexEntry indexEntry);
    @ApiOperation("删除索引")
    @GetMapping("/delete/{indexName}")
    public R deleteIndex(@PathVariable String indexName);

    @ApiOperation("判断索引是否存在")
    @GetMapping("isexits/{indexName}")
    public R isExists(@PathVariable String indexName);

    @GetMapping("/get/{indexName}")
    @ApiOperation("获取索引信息")
    public R<IndexInfoResp> getIndex(@PathVariable String indexName);
    @ApiOperation("更新索引")
    @PostMapping("update")
    public R updateIndex(@RequestBody IndexEntry indexEntry);
}
